import time

from selenium.webdriver.common.by import By

from common.Utils import BlogDriver

#测试博客详情页
class BlogDetail:
    url=''
    driver=''
    def __init__(self):
        self.url="http://8.137.19.140:9090/blog_detail.html?blogId=7664"
        self.driver=BlogDriver.driver
        self.driver.get(self.url)




    def DetailByLogin(self):
        #检查标题
        self.driver.find_element(By.CSS_SELECTOR,"body > div.container > div.right > div > div.title")
        #检查时间
        self.driver.find_element(By.CSS_SELECTOR,"body > div.container > div.right > div > div.date")
        #检查内容
        self.driver.find_element(By.CSS_SELECTOR,"#h2-u5728u8FD9u91CCu5199u4E0Bu4E00u7BC7u535Au5BA2")
        #检查编辑按钮
        self.driver.find_element(By.CSS_SELECTOR,"body > div.container > div.right > div > div.operating > button:nth-child(1)")
        #检查删除按钮
        self.driver.find_element(By.CSS_SELECTOR,"body > div.container > div.right > div > div.operating > button:nth-child(2)")
        # 添加屏幕截图
        time.sleep(1)

        BlogDriver.getScreenShot()
